package com.ruoyi.system.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.MyBaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 会话对象 session
 * 
 * @author ruoyi
 * @date 2025-09-23
 */
public class Session extends MyBaseEntity {
    private static final long serialVersionUID = 1L;

    /** 会话ID */
    private String id;

    /** 会话名称 */
    @Excel(name = "会话名称")
    private String sessionName;

    /** 最后一条消息ID，关联消息表 */
    @Excel(name = "最后一条消息ID，关联消息表")
    private String lastMsgId;

    /** 最后一条消息时间，用于会话列表排序 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后一条消息时间，用于会话列表排序", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastMessageTime;

    /** 会话类型（1=一对一聊天，2=群聊） */
    @Excel(name = "会话类型", readConverterExp = "1==一对一聊天，2=群聊")
    private Integer conversationType;

    /** 会话头像URL */
    @Excel(name = "会话头像URL")
    private String avatar;

    /** 会话参与人，多个用逗号分隔 */
    @Excel(name = "会话参与人，多个用逗号分隔")
    private String participantIds;

    /** 是否删除（0=未删除，1=已删除） */
    @Excel(name = "是否删除", readConverterExp = "0==未删除，1=已删除")
    private Integer isDeleted;

    /** 版本号，用于乐观锁 */
    @Excel(name = "版本号，用于乐观锁")
    private Long version;

    /** 创建人ID */
    @Excel(name = "创建人ID")
    private String creator;

    public void setId(String id) 
    {
        this.id = id;
    }

    public String getId() 
    {
        return id;
    }

    public void setSessionName(String sessionName) 
    {
        this.sessionName = sessionName;
    }

    public String getSessionName() 
    {
        return sessionName;
    }

    public void setLastMsgId(String lastMsgId) 
    {
        this.lastMsgId = lastMsgId;
    }

    public String getLastMsgId() 
    {
        return lastMsgId;
    }

    public void setLastMessageTime(Date lastMessageTime) 
    {
        this.lastMessageTime = lastMessageTime;
    }

    public Date getLastMessageTime() 
    {
        return lastMessageTime;
    }

    public void setConversationType(Integer conversationType)
    {
        this.conversationType = conversationType;
    }

    public Integer getConversationType()
    {
        return conversationType;
    }

    public void setAvatar(String avatar) 
    {
        this.avatar = avatar;
    }

    public String getAvatar() 
    {
        return avatar;
    }

    public void setParticipantIds(String participantIds) 
    {
        this.participantIds = participantIds;
    }

    public String getParticipantIds() 
    {
        return participantIds;
    }

    public void setIsDeleted(Integer isDeleted)
    {
        this.isDeleted = isDeleted;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setVersion(Long version)
    {
        this.version = version;
    }

    public Long getVersion() 
    {
        return version;
    }

    public void setCreator(String creator) 
    {
        this.creator = creator;
    }

    public String getCreator() 
    {
        return creator;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("sessionName", getSessionName())
            .append("lastMsgId", getLastMsgId())
            .append("lastMessageTime", getLastMessageTime())
            .append("conversationType", getConversationType())
            .append("avatar", getAvatar())
            .append("participantIds", getParticipantIds())
            .append("isDeleted", getIsDeleted())
            .append("version", getVersion())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .append("creator", getCreator())
            .toString();
    }
}
